<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%
	request.setCharacterEncoding("UTF-8");
	response.setContentType("text/html;charset=UTF-8");
%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%
	String path = request.getContextPath();
%>
<html lang="zh-cn">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport"
	content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no, minimal-ui" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="format-detection" content="telephone=no, email=no" />
<title>登录</title>
<link rel="stylesheet" href="<%=path %>/admin/css/pintuer.css">
<link rel="stylesheet" href="<%=path %>/admin/css/admin.css">
<script type="text/javascript"> var paths = '<%=path%>'; </script>
<script src="<%=path %>/admin/js/jquery.js"></script>
<script src="<%=path %>/admin/js/pintuer.js"></script>
<script src="<%=path %>/admin/js/pic.js"></script>
<script type="text/javascript" src="<%=path %>/admin/js/admin.js"></script>
</head>
<body>
	<div class="panel admin-panel">
		<div class="panel-head" id="add">
			<strong><span class="icon-pencil-square-o"></span>分销分润修改</strong>
		</div>
		<div class="body-content">
			<form id="planForm" method="post" class="form-x" action="<%=path %>/profit/save">
			<input type="hidden" value="${paltformId}" name="paltformId" id="paltformId"/>
			<input type="hidden" value="${type}" name="type" id="type"/>
				<div class="form-group">
					<div class="label">
						<label>产品：</label>
					</div>
					<div class="field">
					   <c:forEach items="${platfromList}" var="item" varStatus="vs">
					     <c:if test="${paltformId==item.id}">
					       <input type="text" class="input w20 clear" value="${item.name }" id="paltformId_" name="paltformId_" />
					     </c:if>
					   </c:forEach>
					</div>
				</div>
				<div class="form-group">
					<div class="label">
						<label>一级分销商分润：</label>
					</div>
					<div class="field">
						<input data-validate="required:请输入数值" type="text" class="input w20 clear" value="${value1}" name="value1" id="value1" onkeyup="clearNoNum(this)" placeholder="单行输入"/>
					</div>
				</div>
				<div class="form-group">
					<div class="label">
						<label>二级分销商分润：</label>
					</div>
					<div class="field">
						<input data-validate="required:请输入数值" type="text" class="input w20 clear" value="${value2}" name="value2" id="value2" onkeyup="clearNoNum(this)" placeholder="单行输入"/>
					</div>
				</div>
				<div class="form-group">
					<div class="label">
						<label>三级分销商分润：</label>
					</div>
					<div class="field">
						<input data-validate="required:请输入数值" type="text" class="input w20 clear" value="${value3}" name="value3" id="value3" onkeyup="clearNoNum(this)" placeholder="单行输入"/>
					</div>
				</div>
				<div class="form-group">
					<div class="label">
						<label>四级分销商分润：</label>
					</div>
					<div class="field">
						<input data-validate="required:请输入数值" type="text" class="input w20 clear" value="${value4}" name="value4" id="value4" onkeyup="clearNoNum(this)" placeholder="单行输入"/>
					</div>
				</div>
				<div class="form-group">
					<div class="label">
						<label>五级分销商分润：</label>
					</div>
					<div class="field">
						<input data-validate="required:请输入值" type="text" class="input w20 clear" value="${value5}" name="value5" id="value5" onkeyup="clearNoNum(this)" placeholder="单行输入"/>
					</div>
				</div>
			
				<div class="form-group">
					<div class="label">
						<label></label>
					</div>
					<div class="field">
						<button class="button bg-main icon-check-square-o" type="button"
							onclick="javascript:sub();">提交</button>
					</div>
				</div>
			</form>
		</div>
	</div>
</body>

<script type="text/javascript">
	function clearNoNum(obj)
	{
	    //先把非数字的都替换掉，除了数字和.
	    obj.value = obj.value.replace(/[^\d.]/g,"");
	    //必须保证第一个为数字而不是.
	    obj.value = obj.value.replace(/^\./g,"");
	    //保证只有出现一个.而没有多个.
	    obj.value = obj.value.replace(/\.{2,}/g,".");
	    //保证.只出现一次，而不能出现两次以上
	    obj.value = obj.value.replace(".","$#$").replace(/\./g,"").replace("$#$",".");
	}


    
	$(function(){
		var paltformId = $("#paltformId").val();
		if(paltformId!=""){
			$("#paltformId_").attr("disabled","disabled").css("background-color","#EEEEEE;");
		}
		var type = $("#type").val();
		if(type=="按订单笔数"){
			$(".type").each(function(){
				$(this).find("option:last").prop("selected", 'selected');  
			});
		}else{
			$(".type").each(function(){
				$(this).find("option:first").prop("selected", 'selected');  
			});
		}
		
		var subTag = '${param.subTag}';
		if(subTag==1){
			layer.msg('操作成功！');
		}else if(subTag== 2){
			layer.msg('系统忙！');
		}
	});
	
	
	$(".type").change(function(){
		var type =$(this).val();
		$("#type").val(type)
		if(type=="按订单笔数"){
			$(".type").each(function(){
				$(this).find("option:last").prop("selected", 'selected');  
			});
		}else{
			$(".type").each(function(){
				$(this).find("option:first").prop("selected", 'selected');  
			});
		}
	});
	
	function LimitTextArea(field){ 
	    maxlimit=100; 
	    if (field.value.length > maxlimit) 
	     field.value = field.value.substring(0, maxlimit);
	  }
	function sub(){
		$("#planForm").submit();
	};
	

	$(".plantags").change(function(){
		var roleitem = "";
		$("input[name='checkTag']").each(function(){
			if($(this).prop("checked")){
				if(roleitem == ""){
				roleitem += $(this).val();
				}
				else{
				roleitem += ","+$(this).val();
				}
			}
		});
		$("#planTag").val(roleitem);
		
	});
	
</script>
</html>